package com.app.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

/**
 * Session 拦截器.
 * @author Administrator
 *
 */
public class SessionInterceptor extends MethodFilterInterceptor{
	private static final long serialVersionUID = 1L;

	protected String doIntercept(ActionInvocation invocation) throws Exception {
		//ServletActionContext.getRequest().getSession().getAttribute("username");
		Object username = invocation.getInvocationContext().getSession().get("username");
		if(null == username)
			return "loginJsp";
		
		return invocation.invoke();
	}
}
